class Car{
    constructor(num,name){
        this.num=num;
        this.name=name;
    }
}

class KCar extends Car{
    constructor(num,name){
        super(num,name)
        this.price = 2
    }
}
class MCar extends Car{
    constructor(num,name,price){
        super(num,name)
        this.price = 1
    }
}
class Trip {
    constructor(car){
        this.car = car
    }
    start(){
        console.log(`我选择了车牌号为${this.car.num}的${this.car.name}`);
        
    }
    end(){
        console.log(`打车金额为${this.car.price*5}元`);
    }
}

var kuaiche = new KCar('川A 62Z28','奔驰')
var trip = new Trip(kuaiche)
trip.start()
trip.end()